package com.example.mydemo.companyType.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.mydemo.companyType.entity.CompanyType;
import com.example.mydemo.companyType.mapper.CompanyTypeMapper;
import com.example.mydemo.companyType.service.ICompanyTypeService;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class CompanyTypeServiceImpl extends ServiceImpl<CompanyTypeMapper, CompanyType> implements ICompanyTypeService {
    @Override
    public List<CompanyType> select() {
        return list();
    }

    @Override
    public Map<Integer, String> idName() {
        List<CompanyType> companyTypes = list();
        Map<Integer, String> map = new HashMap<>();
        for (CompanyType companyType :companyTypes){
            map.put(companyType.getId(), companyType.getName());
        }
        return map;
    }
}
